-
-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Support typing.Literal in Python 3.8+ #429
base: master
Are you sure you want to change the base?
Conversation
📝 Docs preview for commit d83f792 at: https://62d04b8528f3e0240fbc7885--typertiangolo.netlify.app |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #429 +/- ##
==========================================
+ Coverage 96.24% 99.69% +3.44%
==========================================
Files 280 286 +6
Lines 5942 6456 +514
==========================================
+ Hits 5719 6436 +717
+ Misses 223 20 -203 ☔ View full report in Codecov by Sentry. |
📝 Docs preview for commit 7a3466d at: https://639cea33a12b8e0af09de2a5--typertiangolo.netlify.app |
📝 Docs preview for commit 1e261e6 at: https://63a3728fbc88656dcfeedf1c--typertiangolo.netlify.app |
Any updates on merging this? @tiangolo |
Upvote for this PR, as using Literal is more succinct then using enum. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is the possibility to import Literal from typing_extensions to allow this to work for 3.6 (since Typer still says it support it despite being EOL) and 3.7 as well. This may be a moot consideration soon though since 3.7 goes EOL in June 2023 as well if there are any plans to drop unsupported Python versions at some point.
This may require adding a specific dependency for typing_extensions, but it's currently being installed by another dep regardless from some of the CI runs I checked for 3.6+ 4.1-4.4 depending on the Python version.
📝 Docs preview for commit d4cd3c3 at: https://6e1d3ac2.typertiangolo.pages.dev |
📝 Docs preview for commit c7dd353 at: https://89793d8d.typertiangolo.pages.dev |
📝 Docs preview for commit 6065329 at: https://85835217.typertiangolo.pages.dev |
📝 Docs preview for commit 3b9034b at: https://a0405a66.typertiangolo.pages.dev |
Preview of new docs section: https://a0405a66.typertiangolo.pages.dev/tutorial/parameter-types/enum/#literal-choices |
Thanks for this PR @blackary! I've taken the liberty to update this PR with the latest from |
Thanks @svlandeg! |
📝 Docs preview for commit a771189 at: https://4a31fc21.typertiangolo.pages.dev |
Gently ping @tiangolo |
Hi all, There's no need for pinging individual maintainers - this PR is on our internal board and will be reviewed further when Tiangolo has time. All the additional pings make our Github notifications difficult to use and only costs more time 😉 Thanks for your patience! |
📝 Docs preview for commit 74a6116 at: https://ffe72ce6.typertiangolo.pages.dev Modified Pages |
📝 Docs preview for commit c29c5d2 at: https://c23a0dec.typertiangolo.pages.dev Modified Pages |
📝 Docs preview for commit cb93aa4 at: https://2f6cbaf9.typertiangolo.pages.dev Modified Pages |
📝 Docs preview for commit 1834fb8 at: https://9dfe14ad.typertiangolo.pages.dev Modified Pages |
📝 Docs preview for commit f06dcf5 at: https://1c296473.typertiangolo.pages.dev Modified Pages |
Currently, the CI is failing with
I'm pretty confused why this happens here though 🤔 Update: this looks to be an issue separate from this PR - we're looking into it! Update 2: this should be fixed by #967 |
📝 Docs preview for commit 20b55f6 at: https://43e3b3f1.typertiangolo.pages.dev Modified Pages |
Sorry to bother. I wonder what's the status of this PR? |
Copied PR #174 from someone who deleted their account because I think it's worth reopening this PR and adding this functionality to typer.
Original PR message: